import React from "react";
import Child from './child'
import Grandson from './grandson';

export const xxxContext = React.createContext();

function App() {

    let [name, setName] = React.useState('tom');

    const modifyName = () => {
        setName(value => name = Math.random())
    }

    return (
        <div>
            <button onClick={modifyName}>修改名</button> <br />
            爷爷: {name}
            
            <Child name={name} render={(value) => <Grandson name={value}/>}/>
                
        </div>
            
    );
}

export default App;